#include "SDL.h"

#include "GameConstants.h"
#include "utils.h"
#include "Hero.h"

int main(int argc, char* argv[])
{

	SDL_Surface* screen = NULL;
	SDL_Rect rect [2] = {0};

	if(SDL_Init(SDL_INIT_VIDEO) == -1)
	{
		printf("Error SDL_Init: %s\n", SDL_GetError());
		return 1;
	}

	screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, SCREEN_BPP, SDL_DOUBLEBUF | SDL_HWSURFACE);

	if(!screen)
	{
		printf("Error SDL_SetVideoMode: %s\n", SDL_GetError());
		return 1;
	}

	Hero *hero;
	hero = new Hero;

	while(procesar_eventos())
	{
		hero->Update();
		hero->Render(screen, rect + 1);
		SDL_UpdateRects (screen, 2, rect);
		imprimir_rectangulo (screen, rect + 1);

		rect[0] = rect[1];
		SDL_Delay (10);
	}

	SDL_Quit();

	return 0;
}